feat: implement CEP-47 server redirect client/server middleware and re-issuance - #78
Open
abhayguptas wants to merge 7 commits into
Open
feat: implement CEP-47 server redirect client/server middleware and re-issuance#78abhayguptas wants to merge 7 commits into
abhayguptas wants to merge 7 commits into
Conversation
abhayguptas
force-pushed
the
feat/cep-47-redirect
branch
from
July 29, 2026 11:34
8453650 to
fc04859
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements CEP-47 Server Redirect support for
@contextvm/sdk, adding full end-to-end middleware and re-issuance capabilities. It faithfully follows the mentor's callback-driven middleware design without mutating the stateless initialization lifecycle, and allows the client to transparently handle complex chained redirects with a safety hop cap.Features Included
withServerRedirect):resolveRedirectcallback.-32044MCP error payload with the target pubkey and relays.withClientRedirect):-32044error.NostrClientTransportto the target server.maxRedirectsoption (defaulting to 5 hops).ApplesauceRelayPoolmessage handling.applesauce-relayemits raw events rather than typed wrapper objects in thereq()subscription. Fixed the message handler so that subscriptions correctly fire on events.mock-relay-serverconnection mapping which caused test relay timeouts.withClientRedirectis cleanly hooked up intoNostrMCPProxyalongside payments.Testing
Client -> Server A -> Server B -> responds)Client -> Server A -> Server B -> Server C -> responds)Client -> A -> B -> A -> Error thrown via McpError -32044)All unit tests and E2E integration tests are passing successfully.
Changeset
Included a changeset for the upcoming release.